<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>通过鼠标实现选项卡</title>
    <style type="text/css">
        * {
            margin: 0;
            padding: 0;
        }

        #container {
            width: 300px;
            height: 200px;
            /*background-color: green;*/
            display: flex;
            flex-direction: column;
            border: 2px solid snow;

        }

        #container header {
            flex: 0 0 80px;
            width: 100%;

        }

        #container header ul {
            width: 100%;
            height: 100%;
            background-color: red;
            list-style: none;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        #container header ul li {
            flex: 1;
            height: 100%;
            width: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        #container header ul li:hover{
            background-color: aliceblue;
            color: black;
        }

        #container #content {
            flex: 1;
        }

        #container #content div {
            width: 100%;
            height: 100%;
            background-color: cadetblue;
        }

        .show {
            display: block;
        }

        .hide {
            display: none;
        }
    </style>
    <script src="js/vue.js"></script>
</head>
<body>
<div id="app">
    <div id="container">
        <header>
            <ul>
                <li @mouseover="flag=true">选项1</li>
                <li @mouseover="flag=false">选项2</li>
            </ul>
        </header>
        <div id="content">
            <div id="a" :class="{show:flag,hide:!flag}">
                选项11111111111111111111
            </div>
            <div id="b" :class="{show:!flag,hide:flag}">
                选项22222222222222222222
            </div>
        </div>
    </div>
</div>

<script>
    let app = new Vue({
        el: "#app",
        data: {
            flag: true,

        }
    })
</script>
</body>
</html>